import React from 'react';
import AllInboxOutlined from '@material-ui/icons/AllInboxOutlined';
import { NavView, get_mod, loc, NavListSub } from 'sui';
import { TaskView } from './task/view';
import { TraceView } from './trace/view';
import { OrderView } from './order';

const model = (cfg) => {
    const fix = [
        {uid: "part.task", view: TaskView,  value: loc("l_136")},
        {uid: "part.order", view: OrderView, value: loc("l_781")},
        {uid: "part.trace", view: TraceView,  value: loc("l_112")},
    ];

    return get_mod(cfg, fix, "part");
};

const Part = ({ mod, sideopen, cfg }) => <NavView cfg={cfg} model={model(cfg)} mod={mod} sideopen={sideopen} name="part"/>;

const NavPart = (props) => <NavListSub icon={<AllInboxOutlined/>} sub={model(props.cfg)} {...props} scut={15}/>;

export {NavPart, Part};
